
// ==========================================
// Jadoon and Lucas
// Winning or Losing Hearts and Minds? (JoP)
// [Models script]
// ==========================================

quietly log

log using JadoonLucasAFG.log, text replace

// --------------
// data
// --------------

clear
use "dat.dta"
svyset PSU [pweight = MWgt], singleunit(scaled) strata(Strata)

// ==========================================
// heard of daesh
// ==========================================

// --------------
// TABLE 1 - DICHOTOMOUS and CONTINUOUS
// --------------

svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed30

// ==========================================
// how well is government doing securing the country?
// ==========================================

// --------------
// TABLE 2 - DICHOTOMOUS
// --------------

svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_afg30 
svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_nato30 
svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_nato30 any_isk_kill_afg30
// fig 1
margins, at(any_isk_kill_afg30 =(0,1)) vsquish post
matrix M = r(table)
putexcel set "fig1.xlsx", replace
putexcel A1 = matrix(M)

// --------------
// TABLE 3 - CONTINUOUS
// --------------

svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed_afg30
svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed_nato30
svy: logit Q190fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed_nato30 n_isk_killed_afg30

// ==========================================
// over past 6 months has taliban become stronger? weaker/same vs stronger
// ==========================================

// --------------
// TABLE 4 - DICHOTOMOUS
// --------------

svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill30
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed30

// ==========================================
// Appendix Models
// ==========================================

// --------------
// Table 1a: NATO/AFG
// --------------

svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_afg30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_nato30

// --------------
// Table in A4: NATO/AFG
// --------------

// dichotomous
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_afg30
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill_nato30

// continuous
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed_afg30
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed_nato30

// --------------
// Table in A5: high/low
// --------------

// dichotomous
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill30_tier12
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave any_isk_kill30_tier34

// continuous
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed30_tier12
svy: logit Q177fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 nattacks_lag30 i.District i.Gender i.Wave n_isk_killed30_tier34

// --------------
// Table in A6a: APPENDIX MODELS WITH ISK ATTACKS
// --------------

svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave isk_ratio any_isk_kill30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_lag30 isk_ratio any_isk_kill30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave isk_ratio n_isk_killed30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_lag30 isk_ratio n_isk_killed30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_lag30 nattacks_isk_lag30 n_isk_killed30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_isk_lag30 n_isk_killed30

// --------------
// Table in A6b: APPENDIX MODELS WITH ISK ATTACKS (continued)
// --------------

svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_lag30 nattacks_isk_lag30 any_isk_kill30
svy: logit Q481fd i.Ethnic_Cat i.Educ_Cat Income_Int Age Age2 i.District i.Gender i.Wave nattacks_isk_lag30 any_isk_kill30

// ============================
// end
// ============================

log close
